<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        let arr = [14, 55, 36, 251]
            // arr.splice(1, 2, 1)
            // console.log(arr) //[14,1,251]
            // let arr1 = arr.slice(1)
            // console.log(arr1)
        let arr7 = [12, 54, 32, 11]
        let result1 = arr7.reduce((previousValue, currentValue) =>
            previousValue + currentValue,
            0)
        console.log(result1)
        let arr8 = ["as", "wa", "wei", "yue"]
        let result2 = arr8.reduce((previousValue, currentValue) => {
            return previousValue + currentValue.length
        }, 0)
        console.log(result2)
        for (let i = 0; i < arr.length; i++) {
            console.log(arr[i])
        }
        //of
        for (item of arr) {
            console.log(item)
        }
        //in
        for (index in arr) {
            console.log(arr[index])
        }  
    </script>
</body>

</html>